﻿using Castle.Core.Logging;
using System;
using Yto.Common.logging;

namespace Yto.Threading.BackgroundWorkers
{
    public abstract class BaseBgdWorker : BaseRunnable, IBackgroundWorker
    {
        public ILogger Logger { get; set; }

        public BaseBgdWorker()
        {
            Logger = NullLogger.Instance;
        }

        public override void Start()
        {
            base.Start();

            Logger.Info("Start worker:" + ToString());
        }

        public override void Stop()
        {
            base.Stop();
            Logger.Info("Stop worker:" + ToString());
        }

        public override void Wait2Stop()
        {
            base.Wait2Stop();
            Logger.Info("Wait2Stop worker:" + ToString());
        }

        public override string ToString()
        {
            return GetType().FullName;
        }
    }
}
